import { IClient } from '../interface';
import Network from './Network';

export interface Info {
	audioOnly: boolean;
	id: string;
	streamMode: StreamMode;
	isAudioMute: boolean;
	isVideoMute: boolean;
	streamLabel: string;
	muteStatus: boolean;
	isScreenSyncMode: boolean;
}

type StreamMode = 'audio' | 'video';

class StreamInfo {
	public audioOnly: boolean = false;
	public id: string = '';
	public isAudioMute: boolean = false;
	public isVideoMute: boolean = false;
	public streamLabel: string = '';
	public streamMode: StreamMode = 'video';
	public isScreenSyncMode: boolean = false;
	public muteStatus: boolean = false;

	constructor(info?: Info) {
		this.setStreamInfo(info);
	}

	public setStreamInfo(info?: Info) {
		if (!info) return;
		const { audioOnly, id, isAudioMute, isVideoMute, streamLabel, isScreenSyncMode = false, muteStatus = false } = info;
		this.audioOnly = audioOnly;
		this.id = id;
		this.isAudioMute = isAudioMute;
		this.isVideoMute = isVideoMute;
		this.streamLabel = streamLabel;
		this.streamMode = audioOnly ? 'audio' : 'video';
	}
}

export default StreamInfo;
